package com.lovo.service;

import com.lovo.dao.UserDAO;
import com.lovo.model.UserDO;
import lombok.NoArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.annotation.Resource;

//@Data
@NoArgsConstructor
@Service
public class UserService implements IUserService{
    @Resource
    private UserDAO userDAO;
    public UserDO findById(String userId){
        return userDAO.findById(userId);
    }

    @Override
    @Transactional(propagation = Propagation.NESTED)
    public void insert(UserDO userDO) {
        userDAO.insert(userDO);
//        int a = 100/0;
    }


}
